<?php $this->Js->get('#khoa')->event('change',
							$this->Js->request(array('controller' => 'moncds', 'action' => 'capnhatnganhcd'),
							array('update' => '#div_nganh','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>
<?php $this->Js->get('#khoa')->event('change',
							$this->Js->request(array('controller' => 'moncds', 'action' => 'updatexemcd'),
							array('update' => '#div_noidung1','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>
<?php $this->Js->get('#div_nganh')->event('change',
							$this->Js->request(array('controller' => 'moncds', 'action' => 'updatexemcd'),
							array('update' => '#div_noidung1','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>
<?php $this->Js->get('#khoahoc')->event('change',
							$this->Js->request(array('controller' => 'moncds', 'action' => 'updatexemcd'),
							array('update' => '#div_noidung1','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>

<?php /*$this->Js->get('#listcu')->event('change',
							$this->Js->request(array('controller' => 'moncds', 'action' => 'updatecdmoi'),
							array('update' => '#dsmoi','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));*/?>
<div class="moncds index">
	<h2><?php __('Danh mục học phần chuyển đổi');?></h2>
	<?php echo $form->create('Ctdt', array('url'=>array('controller'=>'moncds', 'action'=>'luumoncd')));?>
	<table>
		<tr>
			<td><?php echo $form->input('khoa',array('id'=>'khoa','label'=>'Khoa','type'=>'select','options'=>$khoas));?></td>
			<td><div id='div_nganh'><?php echo $form->input('nganh',array('id'=>'nganh','label'=>'Ngành','type'=>'select','options'=>$nganhs));?></div></td>
			<td><div id='div_khoahoc'><?php echo $form->input('khoahoc',array('id'=>'khoahoc','label'=>'Khóa Học','type'=>'select','options'=>$khoahocs));?></div></td>			
		</tr>		
	</table>
	<?php //echo $form->button('   Thực Hiện   ',array('id'=>'btn'));?>
	
<div id='div_noidung1'>
<div>
<div id='listcu'><?php echo $this->Form->input('listctdtcu', array('id'=>'listctdtcu','label'=>'Môn đã chuyển đổi','type' => 'select','options' =>empty($mondscds)?array():$mondscds,'empty'=>'Chọn môn đã chuyễn đổi'));?></div>
<div id='dsmoi'><?php echo $this->Form->input('listmoncd', array('id'=>'listmoncd','label'=>'Môn CTDT cũ','type' => 'select', 'multiple' => 'multiple','options' =>array()));?></div>
</div>

</div>
<?php echo $form->end();?>
</div>
<script>
	$(function() {
		$("#btn").click(function (event){
											$.ajax({data:$("#btn").closest("form").serialize(),
											dataType:"html",
											success:function (data, textStatus) {$("#div_noidung1").html(data);},
											type:"post",
											url:'../moncds/updatexemcd'
											});
											return false;
	});
		$('#listcu').live('change',function (event){
												$.ajax({data:$("#listcu").closest("form").serialize(),
													dataType:"html",
													success:function (data, textStatus) {$("#dsmoi").html(data);},
													type:"post",
													url:'../moncds/updatecdmoi'
													});
													return false;
													})
		})
</script>